package com.inspur.cloud.service.dataspace;

import com.inspur.cloud.dao.dataspace.KafkaResourceDao;
import com.inspur.cloud.entity.dataspace.KafkaResourceEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

@Service
public class KafkaResourceService {
    @Autowired
    private KafkaResourceDao kafkaResourceDao;

    public List<KafkaResourceEntity> findAll(){
        return kafkaResourceDao.findAll();
    }
    @Transactional(transactionManager = "transactionManagerDataspace")
    public void save(KafkaResourceEntity kafkaResourceEntity){
        kafkaResourceDao.save(kafkaResourceEntity);
    }
    @Transactional(transactionManager = "transactionManagerDataspace")
    public void deleteById(Integer id){
        kafkaResourceDao.deleteById(id);
    }
    public KafkaResourceEntity findKafkaResourceEntityById(Integer id){
        return kafkaResourceDao.findKafkaResourceEntityById(id);
    }
    public List<KafkaResourceEntity> findByParentId(Integer parentId){
        return kafkaResourceDao.findByParentId(parentId);
    }
    public KafkaResourceEntity findFirstByTopicName(String topicName){
        return kafkaResourceDao.findFirstByTopicName(topicName);
    }
    public KafkaResourceEntity findFirstByOwner(Integer owner){
        return kafkaResourceDao.findFirstByOwner(owner);
    }
}
